package com.dididoctor.patient.WYY.Timely;

import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.dididoctor.patient.Activity.Consult.ConsultPresenter;
import com.dididoctor.patient.R;
import com.netease.nim.uikit.session.viewholder.MsgViewHolderBase;
import com.netease.nimlib.sdk.msg.constant.MsgStatusEnum;

/**
 * Created by zhoujianghua on 2015/8/4.
 */
public class MsgViewHolderTimely extends MsgViewHolderBase implements View.OnClickListener {

    private TextView tv_content;
    private Button btn_confirm, btn_confirm_drawdiagn;
    private ConsultPresenter presenter;
    private String PatientPhone;
    private String disId;
    private String recId;
    private String patientName;
    private String age;
    private String illName;
    private String patientHeadPic;

    @Override
    protected int getContentResId() {
        return R.layout.item_timely;

    }

    @Override
    protected void inflateContentView() {

        tv_content = (TextView) view.findViewById(R.id.tv_content);

        btn_confirm = (Button) view.findViewById(R.id.btn_confirm);
        btn_confirm.setOnClickListener(this);
        btn_confirm_drawdiagn = (Button) view.findViewById(R.id.btn_confirm_drawdiagn);
        btn_confirm_drawdiagn.setOnClickListener(this);
    }

    @Override
    protected void setLayoutParams(int width, int height, View... views) {
        View ll_medical = view.findViewById(R.id.ll_medical);
//        setLayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT,ll_medical);
        super.setLayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, ll_medical);
    }

    @Override
    protected void bindContentView() {
        TimelyAttachment attachment = (TimelyAttachment) message.getAttachment();
        PatientPhone = attachment.getPatientPhone();
        disId = attachment.getDisId();
        recId = attachment.getRecId();
        patientName = attachment.getPatientName();
        age = attachment.getAge();
        illName = attachment.getIllName();
        patientHeadPic = attachment.getPatientHeadPic();
        recId = attachment.getRecId();
        tv_content.setText("患者" + attachment.getPatientName() + "进行了电话咨询");

    }

    @Override
    protected boolean isMiddleItem() {
        return true;
    }

    @Override
    protected boolean isShowBubble() {
        return false;
    }

    @Override
    protected boolean onItemLongClick() {

        return false;
    }

    @Override
    protected int leftBackground() {
        return 0;
    }

    @Override
    protected int rightBackground() {
        return 0;
    }

    private void layoutByDirection() {
        View ll_medical = findViewById(R.id.ll_medical);
        View tv_guess_medical_click = findViewById(R.id.tv_guess_medical_click);

        ViewGroup container = (ViewGroup) ll_medical.getParent();
        container.removeView(tv_guess_medical_click);
        if (isReceivedMessage()) {
            container.addView(tv_guess_medical_click, 1);
        } else {
            container.addView(tv_guess_medical_click, 0);
        }
        if (message.getStatus() == MsgStatusEnum.success) {
        } else {
        }
    }

    @Override
    public void onClick(View v) {

    }
}
